package com.sitanyun.merchant.guide.presenter.impl;

import com.sitanyun.merchant.guide.model.impl.MainAModelImpl;
import com.sitanyun.merchant.guide.model.inter.IMainAModel;
import com.sitanyun.merchant.guide.presenter.callback.CallBack;
import com.sitanyun.merchant.guide.presenter.inter.IMainAPresenter;
import com.sitanyun.merchant.guide.view.inter.IMainAView;

public class MainAPresenterImpl implements IMainAPresenter {
    private IMainAView mIMainAView;
    private IMainAModel mIMainAModel;

    public MainAPresenterImpl(IMainAView aIMainAView) {
        mIMainAView = aIMainAView;
        mIMainAModel = new MainAModelImpl();
    }

    @Override
    public void getversion(String platform, String appType) {
        mIMainAModel.setversion(platform, appType, new CallBack() {
            @Override
            public void onSuccess(Object response) {
                mIMainAView.response(response,mIMainAView.RESPONSE_ONE);
            }

            @Override
            public void onError(Throwable t) {
                mIMainAView.response(t,mIMainAView.RESPONSE_TWO);
            }
        });
    }

    @Override
    public void getsave(String staffId, String deviceId, String regId, String deviceType) {
        mIMainAModel.setsave(staffId, deviceId, regId, deviceType, new CallBack() {
            @Override
            public void onSuccess(Object response) {
                mIMainAView.responsesave(response,mIMainAView.RESPONSE_ONE);
            }

            @Override
            public void onError(Throwable t) {
                mIMainAView.responsesave(t,mIMainAView.RESPONSE_TWO);
            }
        });
    }
}
